package net.betou.trade.entity.main.base;

import java.io.Serializable;

import net.betou.trade.entity.main.Role;
import net.betou.trade.entity.main.RoleExt;

/**
 * 居间商角色分配
 * @author 叶装装
 *
 */
public class BaseRoleExt implements Serializable{
	
	private static final long serialVersionUID = -2691571407164674337L;
	
	private Integer id; // 主键
	private String key; // 该key不可重复，并且确定之后不可修改
	private String description; // 描述信息
	private Integer findDeep;   // 查询深度
	private Integer deleteDeep; // 删除深度
	private Integer updateDeep;  // 更新深度
	private String viewRoles; // 可以查看的分组信息
	
	private Role role; // many to one
	
	public BaseRoleExt( ){
		initialize( );
	}
	
	protected void initialize( ) {
	}
	
	private int hashCode = Integer.MIN_VALUE;

	public boolean equals( Object obj ) {
		if( null == obj )
			return false;
		if( !( obj instanceof Role ) )
			return false;
		else{
			RoleExt ext = ( RoleExt ) obj;
			if( null == this.getId( ) || null == ext.getId( ) )
				return false;
			else
				return( this.getId( ).equals( ext.getId( ) ) );
		}
	}

	public int hashCode( ) {
		if( Integer.MIN_VALUE == this.hashCode ){
			if( null == this.getId( ) )
				return super.hashCode( );
			else{
				String hashStr = this.getClass( ).getName( ) + ":" + this.getId( ).hashCode( );
				this.hashCode = hashStr.hashCode( );
			}
		}
		return this.hashCode;
	}

	public Integer getId( ) {
		return id;
	}

	public void setId( Integer id ) {
		this.id = id;
		this.hashCode = Integer.MIN_VALUE;
	}

	public String getKey( ) {
		return key;
	}

	public void setKey( String key ) {
		this.key = key;
	}

	public String getDescription( ) {
		return description;
	}

	public void setDescription( String description ) {
		this.description = description;
	}

	public Integer getFindDeep( ) {
		return findDeep;
	}

	public void setFindDeep( Integer findDeep ) {
		this.findDeep = findDeep;
	}

	public Integer getDeleteDeep( ) {
		return deleteDeep;
	}

	public void setDeleteDeep( Integer deleteDeep ) {
		this.deleteDeep = deleteDeep;
	}

	public Integer getUpdateDeep( ) {
		return updateDeep;
	}

	public void setUpdateDeep( Integer updateDeep ) {
		this.updateDeep = updateDeep;
	}

	public Role getRole( ) {
		return role;
	}

	public void setRole( Role role ) {
		this.role = role;
	}

	public String getViewRoles( ) {
		return viewRoles;
	}

	public void setViewRoles( String viewRoles ) {
		this.viewRoles = viewRoles;
	}
	
}
